package method.method1202;

import java.util.Scanner;

//键盘录入5个数，构成一个数组，选出最大值和最小值
public class arr03 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入5个数：");
        int[] arr=new int[5];
        arr[0]=sc.nextInt();
        int max=arr[0];
        int min=arr[0];
        for (int i = 1; i < arr.length; i++) {
            arr[i]=sc.nextInt();
            max=max>=arr[i]?max:arr[i];
            min=min<arr[i]?min:arr[i];
        }
        System.out.println("最大值是："+max);
        System.out.println("最小值是："+min);
    }
}
